FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY HelloOne.sln ./
COPY src/svc/HelloOne.NewsSvc/HelloOne.NewsSvc.csproj src/svc/HelloOne.NewsSvc/
COPY src/store/HelloOne.Repositories.EF/HelloOne.Repositories.EF.csproj src/store/HelloOne.Repositories.EF/
COPY src/store/HelloOne.Repositories/HelloOne.Repositories.csproj src/store/HelloOne.Repositories/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/src/svc/HelloOne.NewsSvc
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "HelloOne.NewsSvc.dll"]
